﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace KPIClient.Views
{
    /// <summary>
    /// ViewQuestionNaireHome.xaml 的交互逻辑
    /// </summary>
    public partial class ViewQuestionNaireHome : UserControl
    {
        public ViewQuestionNaireHome()
        {
            InitializeComponent();
            this.Loaded += ViewQuestionNaireHome_Loaded;
        }

        void InitPage()
        {
            viewQuestionNaireList.Event_CerateNaire += ((int data) =>
            {
                this.ctrl_Content.Content = viewCreateQuestionNaire;
            });
            viewQuestionNaireList.Event_GoNaireRecordUserList += ((string data) =>
            {
                this.ctrl_Content.Content = new RecordDetail(data);
            });
            viewCreateQuestionNaire.Event_AfterCreateQuestionNaire += ((string data) =>
            {
                viewEditQuesionNaire.questionNaireId = data;
                this.ctrl_Content.Content = viewEditQuesionNaire;
            });
            viewQuestionNaireList.Event_EditQuestionNaire += ((string data) =>
            {
                viewEditQuesionNaire.questionNaireId = data;
                this.ctrl_Content.Content = viewEditQuesionNaire;
            });

        }
        private void ViewQuestionNaireHome_Loaded(object sender, RoutedEventArgs e)
        {
            InitPage();
            BtnClick_SwitchQuestionNaire(null, null);
        }

        ViewEditQuestionNaire viewEditQuesionNaire = new ViewEditQuestionNaire();
        ViewQuestionList viewQuestion = new ViewQuestionList();
        ViewQuestionNaireList viewQuestionNaireList = new ViewQuestionNaireList();
        ViewCreateQuestionNaire viewCreateQuestionNaire = new ViewCreateQuestionNaire();

        private void BtnClick_SwitchQuestion(object sender, RoutedEventArgs e)
        {
            this.ctrl_Content.Content = viewQuestion;
        }

        private void BtnClick_SwitchQuestionNaire(object sender, RoutedEventArgs e)
        {
            this.ctrl_Content.Content = viewQuestionNaireList;
        }
    }
}
